

****************************************************************************************************************************************		
******************************** Replication File *******************************************************************
*****************************************************************************************************************************************

*Title of the article: How Stress Affects Performance and Competitiveness across Gender
*Journal: Management Science
*Authors: Jana Cahlikova, Lubomir Cingl, Ian Levely   
*Contact: jana.cahlikova@tax.mpg.de
*Data and statistical code are deposited at Harvard Dataverse (doi:10.7910/DVN/IQIPSI)

*****************************************************************************************************************************************

***************************************************************************************************************************************		
****************************** BASIC INFO for the replication

****************************** 
****Change the directory here to your folder where this code and all the datafiles have been stored
cd "C:\"

****************************** 
****Datasets
use "Data_stress_competition_gender.dta", clear
*also stata 13 and stata 13 versions available
*use "Data_stress_competition_gender_stata13.dta", clear
*use "Data_stress_competition_gender_stata12.dta", clear


******************************
*Create a folder where Tables and figures will be stored (if already there, delete the following line)
*mkdir Tables_Figures_Paper, public


***************************************************************************************************************************************		
****************************** TABLE 1 - SUMMARY STATISTICS, PERFORMANCE IN THE COUNTING TASK ***********************************************
*and related analysis in the test		
*****************************************************************************************************************************************

use "Data_stress_competition_gender.dta", clear

	********************************************************************************************
	***Task 1
		*Treatment diff
			ttest  Task1Solved, by(T_Stress)
			ttest  Task1Solved if Female==0, by(T_Stress)
			ttest  Task1Solved if Female==1, by(T_Stress)

			ranksum  Task1Solved, by(T_Stress)
			ranksum  Task1Solved if Female==0, by(T_Stress)
			ranksum  Task1Solved if Female==1, by(T_Stress)

		*Gender diff
			ttest  Task1Solved, by(Female)
			ttest  Task1Solved if T_Stress==0, by(Female)
			ttest  Task1Solved if T_Stress==1, by(Female)

			ranksum  Task1Solved, by(Female)
			ranksum  Task1Solved if T_Stress==0, by(Female)
			ranksum  Task1Solved if T_Stress==1, by(Female)

	
	********************************************************************************************
	***Task 2
		*Treatment diff
			ttest  Task2Solved, by(T_Stress)
			ttest  Task2Solved if Female==0, by(T_Stress)
			ttest  Task2Solved if Female==1, by(T_Stress)

			ranksum  Task2Solved, by(T_Stress)
			ranksum  Task2Solved if Female==0, by(T_Stress)
			ranksum  Task2Solved if Female==1, by(T_Stress)

		*Gender diff
			ttest  Task2Solved, by(Female)
			ttest  Task2Solved if T_Stress==0, by(Female)
			ttest  Task2Solved if T_Stress==1, by(Female)

			ranksum  Task2Solved, by(Female)
			ranksum  Task2Solved if T_Stress==0, by(Female)
			ranksum  Task2Solved if T_Stress==1, by(Female)

	********************************************************************************************
	***Task 3
		*Treatment diff
			ttest  Task3Solved, by(T_Stress)
			ttest  Task3Solved if Female==0, by(T_Stress)
			ttest  Task3Solved if Female==1, by(T_Stress)

			ranksum  Task3Solved, by(T_Stress)
			ranksum  Task3Solved if Female==0, by(T_Stress)
			ranksum  Task3Solved if Female==1, by(T_Stress)
			
			*It holds when we exclude all women with lower than perfect understanding
			ttest  Task3Solved if Female==1 & instructclear==10, by(T_Stress)
			ranksum  Task3Solved if Female==1 & instructclear==10, by(T_Stress)


		*Gender diff
			ttest  Task3Solved, by(Female)
			ttest  Task3Solved if T_Stress==0, by(Female)
			ttest  Task3Solved if T_Stress==1, by(Female)

			ranksum  Task3Solved, by(Female)
			ranksum  Task3Solved if T_Stress==0, by(Female)
			ranksum  Task3Solved if T_Stress==1, by(Female)

	********************************************************************************************
	***Task 4
		*Treatment diff
			ttest  Task4Solved, by(T_Stress)
			ttest  Task4Solved if Female==0, by(T_Stress)
			ttest  Task4Solved if Female==1, by(T_Stress)

			ranksum  Task4Solved, by(T_Stress)
			ranksum  Task4Solved if Female==0, by(T_Stress)
			ranksum  Task4Solved if Female==1, by(T_Stress)
		*Gender diff
			ttest  Task4Solved, by(Female)
			ttest  Task4Solved if T_Stress==0, by(Female)
			ttest  Task4Solved if T_Stress==1, by(Female)

			ranksum  Task4Solved, by(Female)
			ranksum  Task4Solved if T_Stress==0, by(Female)
			ranksum  Task4Solved if T_Stress==1, by(Female)

	********************************************************************************************
	***Effect of stress on performance = Task 2 - Task 1
		*Treatment diff
			ttest stress_diff, by(T_Stress)
			ttest stress_diff if Female==0, by(T_Stress)
			ttest stress_diff if Female==1, by(T_Stress)

			ranksum  stress_diff, by(T_Stress)
			ranksum  stress_diff if Female==0, by(T_Stress)
			ranksum  stress_diff if Female==1, by(T_Stress)

		*Gender diff
			ttest  stress_diff, by(Female)
			ttest  stress_diff if T_Stress==0, by(Female)
			ttest  stress_diff if T_Stress==1, by(Female)

			ranksum  stress_diff, by(Female)
			ranksum  stress_diff if T_Stress==0, by(Female)
			ranksum  stress_diff if T_Stress==1, by(Female)


	********************************************************************************************
	***Effect of tournament incentives on performance = Task 3 - Task 2
		*Treatment diff
			ttest tourn_diff, by(T_Stress)
			ttest tourn_diff if Female==0, by(T_Stress)
			ttest tourn_diff if Female==1, by(T_Stress)

			ranksum  tourn_diff, by(T_Stress)
			ranksum  tourn_diff if Female==0, by(T_Stress)
			ranksum  tourn_diff if Female==1, by(T_Stress)

		*Gender diff
			ttest  tourn_diff, by(Female)
			ttest  tourn_diff if T_Stress==0, by(Female)
			ttest  tourn_diff if T_Stress==1, by(Female)

			ranksum  tourn_diff, by(Female)
			ranksum  tourn_diff if T_Stress==0, by(Female)
			ranksum  tourn_diff if T_Stress==1, by(Female)
			
		****Test the improvement between Task 2 and Task 3 using a non-parametric test (Wilcoxon signed-rank test)
			signrank  tourn_diff=0 if T_Stress==0
			signrank  tourn_diff=0 if T_Stress==0 & Female==0
			signrank  tourn_diff=0 if T_Stress==0 & Female==1

			signrank  tourn_diff=0 if T_Stress==1
			signrank tourn_diff=0 if T_Stress==1 & Female==0
			signrank  tourn_diff=0 if T_Stress==1 & Female==1

		****How many people got worse or better under Tournament? 
			gen Better_in_Tournament_R3R2=0
			replace	Better_in_Tournament_R3R2=1 if Task3Solved>Task2Solved
			gen Worse_in_Tournament_R3R2=0
			replace	Worse_in_Tournament_R3R2=1 if Task3Solved<Task2Solved

			*Women
			ttest  Better_in_Tournament_R3R2 if Female==1,by(T_Stress)
			ttest  Worse_in_Tournament_R3R2 if Female==1,by(T_Stress)
			*Men
			ttest  Better_in_Tournament_R3R2 if Female==0,by(T_Stress)
			ttest  Worse_in_Tournament_R3R2 if Female==0,by(T_Stress)

			*Compare distributions
			gen BetterSameWorse_in_Tournament=0
			replace	BetterSameWorse_in_Tournament=1 if Task3Solved>Task2Solved
			replace	BetterSameWorse_in_Tournament=2 if Task3Solved==Task2Solved
			replace	BetterSameWorse_in_Tournament=3 if Task3Solved<Task2Solved

			tabulate BetterSameWorse_in_Tournament T_Stress if Female==1, chi2
			tabulate BetterSameWorse_in_Tournament T_Stress if Female==0, chi2


***************************************************************************************************************************************		
****************************** TABLE 2 - THE EFFECT OF STRESS, COMPETITION AND GENDER ON PERFORMANCE ************************************
*****************************************************************************************************************************************
	
use "Data_stress_competition_gender.dta", clear
		
			reg Task3Solved T_Stress Female Task1Solved, cluster(session)
			outreg2 using "Tables_Figures_Paper\Table 2.xls" , replace dec(2)
			reg Task3Solved T_Stress Female TStress_Female Task1Solved, cluster(session)
			outreg2
			reg Task3Solved T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task3Solved T_Stress  Task1Solved if Female==1, cluster(session)
			outreg2

			reg tourn_diff T_Stress Female  Task1Solved, cluster(session)
			outreg2 using "Tables_Figures_Paper\Table 2.xls" , append dec(2)
			reg tourn_diff T_Stress Female TStress_Female Task1Solved, cluster(session)
			outreg2
			reg tourn_diff T_Stress  Task1Solved if Female==0, cluster(session)
			outreg2
			reg tourn_diff T_Stress  Task1Solved if Female==1, cluster(session)
			outreg2
			
			
***************************************************************************************************************************************		
****************************** TABLE 3 - SUMMARY STATISTICS, WILLINGNESS TO COMPETE BY TREATMENT AND TASK *****************************
*****************************************************************************************************************************************
	
use "Data_stress_competition_gender.dta", clear
	
	********************************************************************************************
	***Panel A: Task 4 Choice - Future performance under treatment
		*Treatment diff
			ttest Task4Investcomp, by(T_Stress)
			ttest Task4Investcomp if Female==0, by(T_Stress)
			ttest Task4Investcomp if Female==1, by(T_Stress)

			ranksum Task4Investcomp, by(T_Stress)
			ranksum Task4Investcomp if Female==0, by(T_Stress)
			ranksum Task4Investcomp if Female==1, by(T_Stress)

		*Gender diff
			ttest  Task4Investcomp, by(Female)
			ttest  Task4Investcomp if T_Stress==0, by(Female)
			ttest  Task4Investcomp if T_Stress==1, by(Female)

			ranksum  Task4Investcomp, by(Female)
			ranksum  Task4Investcomp if T_Stress==0, by(Female)
			ranksum  Task4Investcomp if T_Stress==1, by(Female)

	********************************************************************************************
	***Panel B: Task 5 Choice - Past performance before treatment	
		*Treatment diff
			ttest Task5Investcomp, by(T_Stress)
			ttest Task5Investcomp if Female==0, by(T_Stress)
			ttest Task5Investcomp if Female==1, by(T_Stress)

			ranksum Task5Investcomp, by(T_Stress)
			ranksum Task5Investcomp if Female==0, by(T_Stress)
			ranksum Task5Investcomp if Female==1, by(T_Stress)

		*Gender diff
			ttest  Task5Investcomp, by(Female)
			ttest  Task5Investcomp if T_Stress==0, by(Female)
			ttest  Task5Investcomp if T_Stress==1, by(Female)

			ranksum  Task5Investcomp, by(Female)
			ranksum  Task5Investcomp if T_Stress==0, by(Female)
			ranksum  Task5Investcomp if T_Stress==1, by(Female)

	********************************************************************************************
	***Panel C: Task 6 Choice - Past performance under treatment
		*Treatment diff
			ttest Task6Investcomp, by(T_Stress)
			ttest Task6Investcomp if Female==0, by(T_Stress)
			ttest Task6Investcomp if Female==1, by(T_Stress)

			ranksum Task6Investcomp, by(T_Stress)
			ranksum Task6Investcomp if Female==0, by(T_Stress)
			ranksum Task6Investcomp if Female==1, by(T_Stress)

		*Gender diff
			ttest  Task6Investcomp, by(Female)
			ttest  Task6Investcomp if T_Stress==0, by(Female)
			ttest  Task6Investcomp if T_Stress==1, by(Female)

			ranksum  Task6Investcomp, by(Female)
			ranksum  Task6Investcomp if T_Stress==0, by(Female)
			ranksum  Task6Investcomp if T_Stress==1, by(Female)


***************************************************************************************************************************************		
****************************** TABLE 4 - EFFECT OF STRESS AND GENDER ON WILLINGNESS TO COMPETE  *****************************
*****************************************************************************************************************************************
use "Data_stress_competition_gender.dta", clear

			reg Task4Investcomp T_Stress Female Task1Solved , cluster(session)
			outreg2  using "Tables_Figures_Paper\Table 4.xls", replace dec(2)
			reg Task4Investcomp T_Stress Female TStress_Female Task1Solved , cluster(session)
			outreg2
			reg Task4Investcomp T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task4Investcomp T_Stress Task1Solved if Female==1, cluster(session)
			outreg2

***************************************************************************************************************************************		
****************************** TABLE A.1 - MEANS, CONTROL VARIABLES AND ROBUSTNESS CHECK ***********************************************
*****************************************************************************************************************************************

use "Data_stress_competition_gender.dta", clear

	********************************************************************************************
	***Panel A: Observable characteristics
	
		*Stress by Gender
			orth_out age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum age if T_Stress==1, by(Female)
			ranksum Siblings if T_Stress==1, by(Female)
			median dum_first_born if T_Stress==1, by(Female) exact
			median  dum_origin if T_Stress==1, by(Female) exact medianties(above)
			median  dum_undergrad if T_Stress==1, by(Female) exact medianties(above)
			ranksum years_study if T_Stress==1, by(Female)
			median  dum_economics_major if T_Stress==1, by(Female) exact medianties(above)
			median  dum_good_grades if T_Stress==1, by(Female) exact medianties(above)
			median  dum_working if T_Stress==1, by(Female) exact 
			median  dum_Math_HS_exam if T_Stress==1, by(Female) exact medianties(above)
			ranksum past_experiments if T_Stress==1, by(Female)
			median  dum_first_experiment if T_Stress==1, by(Female) exact
			ranksum participknown if T_Stress==1, by(Female)
			median  d_no_known_participants if T_Stress==1, by(Female) exact medianties(above)

		*Control by Gender
			orth_out age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants if T_Stress==0 , by(Female) replace  pcompare count bdec(2)
			ranksum age if T_Stress==0, by(Female)
			ranksum Siblings if T_Stress==0, by(Female)
			median dum_first_born if T_Stress==0, by(Female) exact medianties(above)
			median  dum_origin if T_Stress==0, by(Female) exact medianties(above)
			median  dum_undergrad if T_Stress==0, by(Female) exact medianties(above)
			ranksum years_study if T_Stress==0, by(Female)
			median  dum_economics_major if T_Stress==0, by(Female) exact medianties(above)
			median  dum_good_grades if T_Stress==0, by(Female) exact medianties(above)
			median  dum_working if T_Stress==0, by(Female) exact 
			median  dum_Math_HS_exam if T_Stress==0, by(Female) exact medianties(above)
			ranksum past_experiments if T_Stress==0, by(Female)
			median  dum_first_experiment if T_Stress==0, by(Female) exact
			ranksum participknown if T_Stress==0, by(Female)
			median  d_no_known_participants if T_Stress==0, by(Female) exact medianties(above)

		*Male by Treatment
			orth_out age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum age if Female==0, by(T_Stress)
			ranksum Siblings if Female==0, by(T_Stress)
			median dum_first_born if Female==0, by(T_Stress) exact 
			median  dum_origin if Female==0, by(T_Stress) exact medianties(above)
			median  dum_undergrad if Female==0, by(T_Stress) exact medianties(above)
			ranksum years_study if Female==0, by(T_Stress)
			median  dum_economics_major if Female==0, by(T_Stress) exact medianties(above)
			median  dum_good_grades if Female==0, by(T_Stress) exact medianties(above)
			median  dum_working if Female==0, by(T_Stress) exact 
			median  dum_Math_HS_exam if Female==0, by(T_Stress) exact medianties(above)
			ranksum past_experiments if Female==0, by(T_Stress)
			median  dum_first_experiment if Female==0, by(T_Stress) exact
			ranksum participknown if Female==0, by(T_Stress)
			median  d_no_known_participants if Female==0, by(T_Stress) exact medianties(above)

		*Female by Treatment
			orth_out age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum age if Female==1, by(T_Stress)
			ranksum Siblings if Female==1, by(T_Stress)
			median dum_first_born if Female==1, by(T_Stress) exact medianties(above)
			median  dum_origin if Female==1, by(T_Stress) exact medianties(above)
			median  dum_undergrad if Female==1, by(T_Stress) exact medianties(above)
			ranksum years_study if Female==1, by(T_Stress)
			median  dum_economics_major if Female==1, by(T_Stress) exact 
			median  dum_good_grades if Female==1, by(T_Stress) exact medianties(above)
			median  dum_working if Female==1, by(T_Stress) exact 
			median  dum_Math_HS_exam if Female==1, by(T_Stress) exact 
			ranksum past_experiments if Female==1, by(T_Stress)
			median  dum_first_experiment if Female==1, by(T_Stress) exact
			ranksum participknown if Female==1, by(T_Stress)
			median  d_no_known_participants if Female==1, by(T_Stress) exact medianties(above)

			*N
			sum age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants 

	
	********************************************************************************************
	***Panel B: Personality-related controls
	use "Data_stress_competition_gender.dta", clear
	

		*Stress by Gender
			orth_out STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_S NEO_E NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6 if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum STAI if T_Stress==1, by(Female)
			ranksum BFI_O if T_Stress==1, by(Female)
			ranksum BFI_C if T_Stress==1, by(Female)
			ranksum BFI_E if T_Stress==1, by(Female)
			ranksum BFI_A if T_Stress==1, by(Female)
			ranksum BFI_N if T_Stress==1, by(Female)
			ranksum NEO_O if T_Stress==1, by(Female)
			ranksum NEO_S if T_Stress==1, by(Female)
			ranksum NEO_E if T_Stress==1, by(Female)
			ranksum NEO_P if T_Stress==1, by(Female)
			ranksum NEO_N if T_Stress==1, by(Female)
			ranksum Risk_1 if T_Stress==1, by(Female)
			ranksum Risk_2 if T_Stress==1, by(Female)
			ranksum Risk_3 if T_Stress==1, by(Female)
			ranksum Risk_4 if T_Stress==1, by(Female)
			ranksum Risk_5 if T_Stress==1, by(Female)
			ranksum Risk_6 if T_Stress==1, by(Female)

		*Control by Gender
			orth_out STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_S NEO_E NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6 if T_Stress==0 , by(Female) replace  pcompare count bdec(2)
			ranksum STAI if T_Stress==0, by(Female)
			ranksum BFI_O if T_Stress==0, by(Female)
			ranksum BFI_C if T_Stress==0, by(Female)
			ranksum BFI_E if T_Stress==0, by(Female)
			ranksum BFI_A if T_Stress==0, by(Female)
			ranksum BFI_N if T_Stress==0, by(Female)
			ranksum NEO_O if T_Stress==0, by(Female)
			ranksum NEO_S if T_Stress==0, by(Female)
			ranksum NEO_E if T_Stress==0, by(Female)
			ranksum NEO_P if T_Stress==0, by(Female)
			ranksum NEO_N if T_Stress==0, by(Female)
			ranksum Risk_1 if T_Stress==0, by(Female)
			ranksum Risk_2 if T_Stress==0, by(Female)
			ranksum Risk_3 if T_Stress==0, by(Female)
			ranksum Risk_4 if T_Stress==0, by(Female)
			ranksum Risk_5 if T_Stress==0, by(Female)
			ranksum Risk_6 if T_Stress==0, by(Female)
			
		*Male by Treatment
			orth_out STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_S NEO_E NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6 if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum STAI if Female==0, by(T_Stress)
			ranksum BFI_O if Female==0, by(T_Stress)
			ranksum BFI_C if Female==0, by(T_Stress)
			ranksum BFI_E if Female==0, by(T_Stress)
			ranksum BFI_A if Female==0, by(T_Stress)
			ranksum BFI_N if Female==0, by(T_Stress)
			ranksum NEO_O if Female==0, by(T_Stress)
			ranksum NEO_S if Female==0, by(T_Stress)
			ranksum NEO_E if Female==0, by(T_Stress)
			ranksum NEO_P if Female==0, by(T_Stress)
			ranksum NEO_N if Female==0, by(T_Stress)
			ranksum Risk_1 if Female==0, by(T_Stress)
			ranksum Risk_2 if Female==0, by(T_Stress)
			ranksum Risk_3 if Female==0, by(T_Stress)
			ranksum Risk_4 if Female==0, by(T_Stress)
			ranksum Risk_5 if Female==0, by(T_Stress)
			ranksum Risk_6 if Female==0, by(T_Stress)
			
		*Female by Treatment
			orth_out STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_S NEO_E NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6 if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum STAI if Female==1, by(T_Stress)
			ranksum BFI_O if Female==1, by(T_Stress)
			ranksum BFI_C if Female==1, by(T_Stress)
			ranksum BFI_E if Female==1, by(T_Stress)
			ranksum BFI_A if Female==1, by(T_Stress)
			ranksum BFI_N if Female==1, by(T_Stress)
			ranksum NEO_O if Female==1, by(T_Stress)
			ranksum NEO_S if Female==1, by(T_Stress)
			ranksum NEO_E if Female==1, by(T_Stress)
			ranksum NEO_P if Female==1, by(T_Stress)
			ranksum NEO_N if Female==1, by(T_Stress)
			ranksum Risk_1 if Female==1, by(T_Stress)
			ranksum Risk_2 if Female==1, by(T_Stress)
			ranksum Risk_3 if Female==1, by(T_Stress)
			ranksum Risk_4 if Female==1, by(T_Stress)
			ranksum Risk_5 if Female==1, by(T_Stress)
			ranksum Risk_6 if Female==1, by(T_Stress)

			*N
			sum STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_S NEO_E NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6 

	
	********************************************************************************************
	***Panel C: Stress-measurement related controls
	use "Data_stress_competition_gender.dta", clear
	
		*Treatment by Gender
			orth_out Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week  dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum Testos if T_Stress==1, by(Female)
			ranksum Left_2D4D if T_Stress==1, by(Female)
			ranksum Right_2D4D if T_Stress==1, by(Female)
			ranksum height if T_Stress==1, by(Female)
			ranksum weight if T_Stress==1, by(Female)
			median  dum_smoker if T_Stress==1, by(Female) exact 
			median  dum_sport if T_Stress==1, by(Female) exact 
			median  dum_exam_next_week if T_Stress==1, by(Female) exact 
			median  dum_psychiatrist if T_Stress==1, by(Female) exact 
			median  dum_medication if T_Stress==1, by(Female) exact 

		*Control by Gender
			orth_out Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum Testos if T_Stress==0, by(Female)
			ranksum Left_2D4D if T_Stress==0, by(Female)
			ranksum Right_2D4D if T_Stress==0, by(Female)
			ranksum height if T_Stress==0, by(Female)
			ranksum weight if T_Stress==0, by(Female)
			median  dum_smoker if T_Stress==0, by(Female) exact 
			median  dum_sport if T_Stress==0, by(Female) exact 
			median  dum_exam_next_week if T_Stress==0, by(Female) exact 
			median  dum_psychiatrist if T_Stress==0, by(Female) exact 
			median  dum_medication if T_Stress==0, by(Female) exact 
			
		*Male by Treatment
			orth_out Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum Testos if Female==0, by(T_Stress)
			ranksum Left_2D4D if Female==0, by(T_Stress)
			ranksum Right_2D4D if Female==0, by(T_Stress)
			ranksum height if Female==0, by(T_Stress)
			ranksum weight if Female==0, by(T_Stress)
			median  dum_smoker if Female==0, by(T_Stress) exact 
			median  dum_sport if Female==0, by(T_Stress) exact 
			median  dum_exam_next_week if Female==0, by(T_Stress) exact medianties(above)
			median  dum_psychiatrist if Female==0, by(T_Stress) exact 
			median  dum_medication if Female==0, by(T_Stress) exact 
		
		*Female by Treatment
			orth_out Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum Testos if Female==1, by(T_Stress)
			ranksum Left_2D4D if Female==1, by(T_Stress)
			ranksum Right_2D4D if Female==1, by(T_Stress)
			ranksum height if Female==1, by(T_Stress)
			ranksum weight if Female==1, by(T_Stress)
			median  dum_smoker if Female==1, by(T_Stress) exact 
			median  dum_sport if Female==1, by(T_Stress) exact 
			median  dum_exam_next_week if Female==1, by(T_Stress) exact 
			median  dum_psychiatrist if Female==1, by(T_Stress) exact 
			median  dum_medication if Female==1, by(T_Stress) exact 
			median  dum_oral_contracept if Female==1, by(T_Stress) exact 
			median  dum_menstr_now if Female==1, by(T_Stress) exact 
			ranksum days_till_menstr if Female==1, by(T_Stress)

		
		*N
			sum Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr 


***************************************************************************************************************************************		
****************************** TABLE A.2 - MEANS, OTHER STRESS-RELATED VARIABLES ***********************************************
*****************************************************************************************************************************************
	
	********************************************************************************************
	***Panel A: Cortisol
	use "Data_stress_competition_gender.dta", clear
	
		*Stress by Gender
			orth_out Cort_1 Cort_2 Cort_3 cort_inc_2 cort_inc_3 if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum Cort_1 if T_Stress==1, by(Female)
			ranksum Cort_2 if T_Stress==1, by(Female)
			ranksum Cort_3 if T_Stress==1, by(Female)
			ranksum cort_inc_2 if T_Stress==1, by(Female)
			ranksum cort_inc_3 if T_Stress==1, by(Female)
			
			
		*Control by Gender
			orth_out  Cort_1 Cort_2 Cort_3 cort_inc_2 cort_inc_3 if T_Stress==0 , by(Female) replace  pcompare count bdec(2)
			ranksum Cort_1 if T_Stress==0, by(Female)
			ranksum Cort_2 if T_Stress==0, by(Female)
			ranksum Cort_3 if T_Stress==0, by(Female)
			ranksum cort_inc_2 if T_Stress==0, by(Female)
			ranksum cort_inc_3 if T_Stress==0, by(Female)
			
			
		*Males by Treatment
			orth_out  Cort_1 Cort_2 Cort_3 cort_inc_2 cort_inc_3 if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum Cort_1 if Female==0, by(T_Stress)
			ranksum Cort_2 if Female==0, by(T_Stress)
			ranksum Cort_3 if Female==0, by(T_Stress)
			ranksum cort_inc_2 if Female==0, by(T_Stress)
			ranksum cort_inc_3 if Female==0, by(T_Stress)
			
			
		*Females by Treatment
			orth_out  Cort_1 Cort_2 Cort_3 cort_inc_2 cort_inc_3 if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum Cort_1 if Female==1, by(T_Stress)
			ranksum Cort_2 if Female==1, by(T_Stress)
			ranksum Cort_3 if Female==1, by(T_Stress)
			ranksum cort_inc_2 if Female==1, by(T_Stress)
			ranksum cort_inc_3 if Female==1, by(T_Stress)
			

			****check N
			sum  Cort_1 Cort_2 Cort_3 cort_inc_2 cort_inc_3
			
			
		*****Cortisol responses for the text of the article
			*Cortisol increase compared to baseline (Wilcoxon signed-rank test)
				*Men
				signrank  cort_inc_2=0 if T_Stress==1 & Female==0
				signrank  cort_inc_3=0 if T_Stress==1 & Female==0
				*Women
				signrank cort_inc_2=0 if T_Stress==1 & Female==1
				signrank  cort_inc_3=0 if T_Stress==1 & Female==1
			*Cortisol increase compared to control (section 4.4)
				ttest cort_inc_2 , by(T_Stress)

		


	********************************************************************************************
	***Panel B: Heart rate
	use "Data_stress_competition_gender.dta", clear
	
		*Stress by Gender
			orth_out HR_BIG5 HR_TASK1 HR_TSST1 HR_TASK2 HR_TASK3 HR_TSST2 HR_TASK4 HR_TASK4_sol HR_TASK5 HR_diff_TSST1_TASK1 HR_diff_TASK3_TASK2 if T_Stress==1 & HR_Problem==0, by(Female) replace  pcompare count bdec(2)
			ranksum HR_BIG5 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK1 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TSST1 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK2 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK3 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TSST2 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK4 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK4_sol if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_TASK5 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_diff_TSST1_TASK1 if T_Stress==1 & HR_Problem==0, by(Female)
			ranksum HR_diff_TASK3_TASK2 if T_Stress==1 & HR_Problem==0, by(Female)
  
		*Control by Gender
			orth_out  HR_BIG5 HR_TASK1 HR_TSST1 HR_TASK2 HR_TASK3 HR_TSST2 HR_TASK4 HR_TASK4_sol HR_TASK5 HR_diff_TSST1_TASK1 HR_diff_TASK3_TASK2 if T_Stress==0 & HR_Problem==0, by(Female) replace  pcompare count bdec(2)
			ranksum HR_BIG5 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK1 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TSST1 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK2 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK3 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TSST2 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK4 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK4_sol if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_TASK5 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_diff_TSST1_TASK1 if T_Stress==0 & HR_Problem==0, by(Female)
			ranksum HR_diff_TASK3_TASK2 if T_Stress==0 & HR_Problem==0, by(Female)

		*Males by Treatment
			orth_out HR_BIG5 HR_TASK1 HR_TSST1 HR_TASK2 HR_TASK3 HR_TSST2 HR_TASK4 HR_TASK4_sol HR_TASK5 HR_diff_TSST1_TASK1 HR_diff_TASK3_TASK2 if Female==0 & HR_Problem==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum HR_BIG5 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK1 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TSST1 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK2 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK3 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TSST2 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4_sol if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK5 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_diff_TSST1_TASK1 if Female==0 & HR_Problem==0, by(T_Stress)
			ranksum HR_diff_TASK3_TASK2 if Female==0 & HR_Problem==0, by(T_Stress)
			
		*Females by Treatment
			orth_out  HR_BIG5 HR_TASK1 HR_TSST1 HR_TASK2 HR_TASK3 HR_TSST2 HR_TASK4 HR_TASK4_sol HR_TASK5 HR_diff_TSST1_TASK1 HR_diff_TASK3_TASK2 if Female==1 & HR_Problem==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum HR_BIG5 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK1 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TSST1 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK2 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK3 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TSST2 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4_sol if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_TASK5 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_diff_TSST1_TASK1 if Female==1 & HR_Problem==0, by(T_Stress)
			ranksum HR_diff_TASK3_TASK2 if Female==1 & HR_Problem==0, by(T_Stress)
			
			*Average across gender
			ranksum HR_TASK1 if HR_Problem==0, by(T_Stress)
			ranksum HR_TSST1 if HR_Problem==0, by(T_Stress)
			ranksum HR_TASK2 if HR_Problem==0, by(T_Stress)
			ranksum HR_TASK3 if HR_Problem==0, by(T_Stress)
			ranksum HR_TSST2 if HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4 if HR_Problem==0, by(T_Stress)
			ranksum HR_TASK4_sol if HR_Problem==0, by(T_Stress)
			ranksum HR_TASK5 if HR_Problem==0, by(T_Stress)
			
		****check N
			sum HR_BIG5 HR_TASK1 HR_TSST1 HR_TASK2 HR_TASK3 HR_TSST2 HR_TASK4 HR_TASK4_sol HR_TASK5 HR_diff_TSST1_TASK1 HR_diff_TASK3_TASK2 if HR_Problem==0
			
		

	********************************************************************************************
	***Panel C: Confidence
	use "Data_stress_competition_gender.dta", clear
	
		*Stress by Gender
			orth_out confid_1 confid_2 confid_3 if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum confid_1 if T_Stress==1, by(Female)
			ranksum confid_2 if T_Stress==1, by(Female)
			ranksum confid_3 if T_Stress==1, by(Female)
		
		*Control by Gender
			orth_out confid_1 confid_2 confid_3 if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum confid_1 if T_Stress==0, by(Female)
			ranksum confid_2 if T_Stress==0, by(Female)
			ranksum confid_3 if T_Stress==0, by(Female)
		
		*Males by Treatment
			orth_out confid_1 confid_2 confid_3 if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum confid_1 if Female==0, by(T_Stress)
			ranksum confid_2 if Female==0, by(T_Stress)
			ranksum confid_3 if Female==0, by(T_Stress)
					
		*Females by Treatment
			orth_out confid_1 confid_2 confid_3 if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum confid_1 if Female==1, by(T_Stress)
			ranksum confid_2 if Female==1, by(T_Stress)
			ranksum confid_3 if Female==1, by(T_Stress)
			

			****check N
			sum confid_1 confid_2 confid_3 
			
	********************************************************************************************
	***Panel D: Mood
	use "Data_stress_competition_gender.dta", clear
	
	*Stress by Gender
			orth_out MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score MDMQ_after_GB_score MDMQ_after_CN_score MDMQ_after_AT_score MDMQ_diff_GB MDMQ_diff_CN MDMQ_diff_AT if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum MDMQ_before_GB_score if T_Stress==1, by(Female)
			ranksum MDMQ_before_CN_score if T_Stress==1, by(Female)
			ranksum MDMQ_before_AT_score if T_Stress==1, by(Female)
			ranksum MDMQ_after_GB_score if T_Stress==1, by(Female)
			ranksum MDMQ_after_CN_score if T_Stress==1, by(Female)
			ranksum MDMQ_after_AT_score if T_Stress==1, by(Female)
			ranksum MDMQ_diff_GB if T_Stress==1, by(Female)
			ranksum MDMQ_diff_CN if T_Stress==1, by(Female)
			ranksum MDMQ_diff_AT if T_Stress==1, by(Female)
		
		*Control by Gender
			orth_out MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score MDMQ_after_GB_score MDMQ_after_CN_score MDMQ_after_AT_score MDMQ_diff_GB MDMQ_diff_CN MDMQ_diff_AT  if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum MDMQ_before_GB_score if T_Stress==0, by(Female)
			ranksum MDMQ_before_CN_score if T_Stress==0, by(Female)
			ranksum MDMQ_before_AT_score if T_Stress==0, by(Female)
			ranksum MDMQ_after_GB_score if T_Stress==0, by(Female)
			ranksum MDMQ_after_CN_score if T_Stress==0, by(Female)
			ranksum MDMQ_after_AT_score if T_Stress==0, by(Female)
			ranksum MDMQ_diff_GB if T_Stress==0, by(Female)
			ranksum MDMQ_diff_CN if T_Stress==0, by(Female)
			ranksum MDMQ_diff_AT if T_Stress==0, by(Female)
			
		*Males by Treatment
			orth_out MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score MDMQ_after_GB_score MDMQ_after_CN_score MDMQ_after_AT_score MDMQ_diff_GB MDMQ_diff_CN MDMQ_diff_AT  if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum MDMQ_before_GB_score if Female==0, by(T_Stress)
			ranksum MDMQ_before_CN_score if Female==0, by(T_Stress)
			ranksum MDMQ_before_AT_score if Female==0, by(T_Stress)
			ranksum MDMQ_after_GB_score if Female==0, by(T_Stress)
			ranksum MDMQ_after_CN_score if Female==0, by(T_Stress)
			ranksum MDMQ_after_AT_score if Female==0, by(T_Stress)
			ranksum MDMQ_diff_GB if Female==0, by(T_Stress)
			ranksum MDMQ_diff_CN if Female==0, by(T_Stress)
			ranksum MDMQ_diff_AT if Female==0, by(T_Stress)
					
		*Females by Treatment
			orth_out MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score MDMQ_after_GB_score MDMQ_after_CN_score MDMQ_after_AT_score MDMQ_diff_GB MDMQ_diff_CN MDMQ_diff_AT  if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum MDMQ_before_GB_score if Female==1, by(T_Stress)
			ranksum MDMQ_before_CN_score if Female==1, by(T_Stress)
			ranksum MDMQ_before_AT_score if Female==1, by(T_Stress)
			ranksum MDMQ_after_GB_score if Female==1, by(T_Stress)
			ranksum MDMQ_after_CN_score if Female==1, by(T_Stress)
			ranksum MDMQ_after_AT_score if Female==1, by(T_Stress)
			ranksum MDMQ_diff_GB if Female==1, by(T_Stress)
			ranksum MDMQ_diff_CN if Female==1, by(T_Stress)
			ranksum MDMQ_diff_AT if Female==1, by(T_Stress)
	
			****check N
			sum MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score MDMQ_after_GB_score MDMQ_after_CN_score MDMQ_after_AT_score MDMQ_diff_GB MDMQ_diff_CN MDMQ_diff_CN
			
	********************************************************************************************
	***Panel E: Risk-preferences
	use "Data_stress_competition_gender.dta", clear
	
		*Stress by Gender
			orth_out CertaintyEquivalent if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum CertaintyEquivalent if T_Stress==1, by(Female)
						
		*Control by Gender
			orth_out CertaintyEquivalent if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum CertaintyEquivalent if T_Stress==0, by(Female)
						
		*Males by Treatment
			orth_out CertaintyEquivalent if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum CertaintyEquivalent if Female==0, by(T_Stress)
			ttest CertaintyEquivalent if Female==0, by(T_Stress)

						
		*Females by Treatment
			orth_out CertaintyEquivalent if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ttest CertaintyEquivalent if Female==1, by(T_Stress)
			ranksum CertaintyEquivalent if Female==1, by(T_Stress)
			
		*Pooled by Treatment	
			ranksum CertaintyEquivalent , by(T_Stress)


			****check N
					
			sum CertaintyEquivalent
			
	**************************************************************
	******************************
	***Panel F: D2 attention test
	use "Data_stress_competition_gender.dta", clear
	
	*Stress by Gender
			orth_out d2_corr_marked d2_attempted d2_errors_percent if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum d2_corr_marked if T_Stress==1, by(Female)
			ranksum d2_attempted if T_Stress==1, by(Female)
			ranksum d2_errors_percent if T_Stress==1, by(Female)
						
		*Control by Gender
			orth_out d2_corr_marked d2_attempted d2_errors_percent if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum d2_corr_marked if T_Stress==0, by(Female)
			ranksum d2_attempted if T_Stress==0, by(Female)
			ranksum d2_errors_percent if T_Stress==0, by(Female)
			
		*Males by Treatment
			orth_out d2_corr_marked d2_attempted d2_errors_percent if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum d2_corr_marked if Female==0, by(T_Stress)
			ranksum d2_attempted if Female==0, by(T_Stress)
			ranksum d2_errors_percent if Female==0, by(T_Stress)
	
		*Females by Treatment
			orth_out d2_corr_marked d2_attempted d2_errors_percent if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum d2_corr_marked if Female==1, by(T_Stress)
			ranksum d2_attempted if Female==1, by(T_Stress)
			ranksum d2_errors_percent if Female==1, by(T_Stress)

			****check N
			sum d2_corr_marked d2_attempted d2_errors_percent  

	********************************************************************************************
	***Panel G: Check instructions
	use "Data_stress_competition_gender.dta", clear
	
	*Stress by Gender
			orth_out instructclear dum_instrclear numparticip nummales if T_Stress==1, by(Female) replace  pcompare count bdec(2)
			ranksum instructclear if T_Stress==1, by(Female)
			median dum_instrclear if T_Stress==1, by(Female) exact medianties(above)
			ranksum numparticip if T_Stress==1, by(Female)
			ranksum nummales if T_Stress==1, by(Female)
			
		*Control by Gender
			orth_out instructclear dum_instrclear numparticip nummales if T_Stress==0, by(Female) replace  pcompare count bdec(2)
			ranksum instructclear if T_Stress==0, by(Female)
			median dum_instrclear if T_Stress==0, by(Female) exact medianties(above)
			ranksum numparticip if T_Stress==0, by(Female)
			ranksum nummales if T_Stress==0, by(Female)
			
		*Males by Treatment
			orth_out instructclear dum_instrclear numparticip nummales if Female==0, by(T_Stress) replace  pcompare count bdec(2)
			ranksum instructclear if Female==0, by(T_Stress)
			median dum_instrclear if Female==0, by(T_Stress) exact medianties(above)
			ranksum numparticip if Female==0, by(T_Stress)
			ranksum nummales if Female==0, by(T_Stress)
			
		*Females by Treatment
			orth_out instructclear dum_instrclear numparticip nummales if Female==1, by(T_Stress) replace  pcompare count bdec(2)
			ranksum instructclear if Female==1, by(T_Stress)
			median dum_instrclear if Female==1, by(T_Stress) exact medianties(above)
			ranksum numparticip if Female==1, by(T_Stress)
			ranksum nummales if Female==1, by(T_Stress)
			
		*Pooled by Treatment
					ranksum instructclear , by(T_Stress)


			****check N
			sum instructclear dum_instrclear numparticip nummales 

***************************************************************************************************************************************		
****************************** TABLE A.3 - EFFECT OF STRESS AND GENDER ON PERFORMANCE *************************
*****************************************************************************************************************************************
	
	use "Data_stress_competition_gender.dta", clear
	
			reg Task1Solved T_Stress Female , cluster(session)
			outreg2 using "Tables_Figures_Paper\Table_A3.xls" , replace dec(2)
			reg Task1Solved T_Stress Female TStress_Female, cluster(session)
			outreg2
			reg Task2Solved T_Stress Female Task1Solved, cluster(session)
			outreg2 
			reg Task2Solved T_Stress Female TStress_Female Task1Solved, cluster(session)
			outreg2
			reg stress_diff T_Stress Female, cluster(session)
			outreg2 
			reg stress_diff T_Stress Female TStress_Female , cluster(session)
			outreg2
			reg stress_diff T_Stress if Female==0, cluster(session)
			outreg2
			reg stress_diff T_Stress if Female==1, cluster(session)
			outreg2

			
***************************************************************************************************************************************		
****************************** TABLE A.4 - EFFECT OF TOURNAMENT INCENTIVES ON PERFORMANCE, robustness to additional controls *************************
*****************************************************************************************************************************************

	use "Data_stress_competition_gender.dta", clear


		*****Effect of tournament incentives
		reg tourn_diff T_Stress Female TStress_Female Task1Solved, cluster(session)
		outreg2 using "Tables_Figures_Paper\Table_A4.xls" , replace dec(2)
		reg tourn_diff T_Stress Female TStress_Female Task1Solved age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_E NEO_S NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved  Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved Cort_1, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved HR_BIG5 HR_TASK1 if HR_Problem==0, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female TStress_Female Task1Solved dum_instrclear, cluster(session)
		outreg2
	
			
***************************************************************************************************************************************		
****************************** TABLE A.5 - EFFECT OF STRESS ON TOURNAMENT PERFORMANCE, robustness to baseline performance  *****
*****************************************************************************************************************************************
	
	use "Data_stress_competition_gender.dta", clear

		reg tourn_diff Female Task1Solved, cluster(session)
		outreg2 using "Tables_Figures_Paper\Table_A5.xls" , replace dec(2)
		reg tourn_diff Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female, cluster(session)
		outreg2 
		reg tourn_diff T_Stress Female TStress_Female, cluster(session)
		outreg2
		reg tourn_diff T_Stress Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2 
		reg tourn_diff T_Stress Female TStress_Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2
		
		
***************************************************************************************************************************************		
****************************** TABLE A.6 - GENDER vs. BASELINE ABILITY *************************
*****************************************************************************************************************************************

	use "Data_stress_competition_gender.dta", clear
			
			tab Task1Solved
			tab Task1Solved Female

			egen Task1_groups=cut(Task1Solved), group(5)
			tab Task1Solved Task1_groups
			tab Task1_groups Female
			tab Task1_groups T_Stress if Female==0
			tab Task1_groups T_Stress if Female==1

			quietly tabulate Task1_groups, generate(Task1group_)
			gen Female_Task1group1=Female*Task1group_1
			gen Female_Task1group2=Female*Task1group_2
			gen Female_Task1group3=Female*Task1group_3
			gen Female_Task1group4=Female*Task1group_4
			gen Female_Task1group5=Female*Task1group_5

			gen TStress_Task1group1=T_Stress*Task1group_1
			gen TStress_Task1group2=T_Stress*Task1group_2
			gen TStress_Task1group3=T_Stress*Task1group_3
			gen TStress_Task1group4=T_Stress*Task1group_4
			gen TStress_Task1group5=T_Stress*Task1group_5
									
			gen Task1WorseHalf=0
			replace Task1WorseHalf=1 if Task1Solved<=6
			tab Task1WorseHalf Female
			gen Task1WorseHalf_TStress= Task1WorseHalf*T_Stress
				
									
				*Columns 1-3			
							reg tourn_diff T_Stress Female TStress_Female Task1WorseHalf , cluster(session)
							outreg2 using "Tables_Figures_Paper\Table_A6.xls" , replace dec(2)
							reg tourn_diff T_Stress Female Task1WorseHalf Task1WorseHalf_TStress, cluster(session)
							outreg2
							reg tourn_diff T_Stress Female TStress_Female Task1WorseHalf Task1WorseHalf_TStress, cluster(session)
							outreg2
							
				*Columns 4-8
							reg tourn_diff T_Stress Female TStress_Female if Task1group_1==1, cluster(session)
							outreg2 using "Tables_Figures_Paper\Table_A6.xls" , append dec(2)
							reg tourn_diff T_Stress Female TStress_Female if Task1group_2==1, cluster(session)
							outreg2 
							reg tourn_diff T_Stress Female TStress_Female if Task1group_3==1, cluster(session)
							outreg2 
							reg tourn_diff T_Stress Female TStress_Female if Task1group_4==1, cluster(session)
							outreg2 
							reg tourn_diff T_Stress Female TStress_Female if Task1group_5==1, cluster(session)
							outreg2 

							*Effect of stress on women (T_Stress + TStress_Female)
								reg tourn_diff T_Stress Female TStress_Female if Task1group_1==1, cluster(session)
									lincomest T_Stress+TStress_Female
									outreg2 using "Tables_Figures_Paper\Table_A6.xls" , replace dec(2)
								reg tourn_diff T_Stress Female TStress_Female if Task1group_2==1, cluster(session)
									lincomest T_Stress+TStress_Female
									outreg2 
								reg tourn_diff T_Stress Female TStress_Female if Task1group_3==1, cluster(session)
									lincomest T_Stress+TStress_Female
									outreg2 
								reg tourn_diff T_Stress Female TStress_Female if Task1group_4==1, cluster(session)
									lincomest T_Stress+TStress_Female
									outreg2 
								reg tourn_diff T_Stress Female TStress_Female if Task1group_5==1, cluster(session)
									lincomest T_Stress+TStress_Female
									outreg2 

***************************************************************************************************************************************		
****************************** TABLE A.7 - TASK 4 PERFORMANCE (PERFORMANCE UNDER THE CHOSEN COMPENSATION SCHEME)*************************
*****************************************************************************************************************************************	

	use "Data_stress_competition_gender.dta", clear

			reg Task4Solved T_Stress Female Task1Solved, cluster(session)
			outreg2 using "Tables_Figures_Paper\Table_A7.xls" , replace dec(2)
			reg Task4Solved T_Stress Female TStress_Female Task1Solved, cluster(session)
			outreg2
			reg Task4Solved T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task4Solved T_Stress Task1Solved if Female==1, cluster(session)
			outreg2
			
***************************************************************************************************************************************		
****************************** TABLE A.8 - WTC binary measure*************************
*****************************************************************************************************************************************									
	
	use "Data_stress_competition_gender.dta", clear
	
		gen Task4_tournament_binary=0
		replace Task4_tournament_binary=1 if Task4Investcomp>50

		probit Task4_tournament_binary T_Stress Female Task1Solved, cluster(session)
		mfx
		outreg2  using "Tables_Figures_Paper\Table_A8.xls", mfx replace dec(2)
		probit Task4_tournament_binary T_Stress Female TStress_Female Task1Solved , cluster(session)
		mfx
		outreg2
		probit Task4_tournament_binary T_Stress Task1Solved if Female==0, cluster(session)
		mfx
		outreg2
		probit Task4_tournament_binary T_Stress Task1Solved if Female==1, cluster(session)
		mfx
		outreg2

***************************************************************************************************************************************		
****************************** TABLE A.9 - EFFECT OF STRESS AND GENDER ON WILLINGNESS TO COMPETE, robustness to baseline performance  *****
*****************************************************************************************************************************************
	use "Data_stress_competition_gender.dta", clear

		reg Task4Investcomp Female Task1Solved , cluster(session)
		outreg2  using "Tables_Figures_Paper\Table_A9.xls", replace dec(2)
		reg Task4Investcomp Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2
		reg Task4Investcomp T_Stress Female, cluster(session)
		outreg2  
		reg Task4Investcomp T_Stress Female TStress_Female, cluster(session)
		outreg2  
		reg Task4Investcomp T_Stress Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2  
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved Female_Task1Solved, cluster(session)
		outreg2

***************************************************************************************************************************************		
****************************** TABLE A.10 - EFFECT OF STRESS ON WTC, additional controls *************************
*****************************************************************************************************************************************
	
	use "Data_stress_competition_gender.dta", clear

		*****Wtc with gender interaction effect
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved, cluster(session)
		outreg2 using "Tables_Figures_Paper\Table_A10.xls" , replace dec(2)
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants, cluster(session)
		outreg2		
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_E NEO_S NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6, cluster(session)
		outreg2			
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved  Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr , cluster(session)
		outreg2		
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved Cort_1 , cluster(session)
		outreg2			
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved HR_BIG5 HR_TASK1 if HR_Problem==0, cluster(session)
		outreg2			
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score, cluster(session)
		outreg2
		reg Task4Investcomp T_Stress Female TStress_Female Task1Solved dum_instrclear, cluster(session)
		outreg2		
		
			
		*Pooled effect of stress (Men and Women) 	
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2 using "Tables_Figures_Paper\Table_A10.xls" , replace dec(2)
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved age Siblings dum_first_born dum_origin dum_undergrad years_study dum_economics_major dum_good_grades dum_working dum_Math_HS_exam past_experiments dum_first_experiment participknown d_no_known_participants, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved STAI BFI_O BFI_C BFI_E BFI_A BFI_N NEO_O NEO_E NEO_S NEO_P NEO_N Risk_1 Risk_2 Risk_3 Risk_4 Risk_5 Risk_6, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved  Testos Left_2D4D Right_2D4D height weight dum_smoker dum_sport dum_exam_next_week dum_psychiatrist dum_medication dum_oral_contracept dum_menstr_now days_till_menstr, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved Cort_1 , cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved HR_BIG5 HR_TASK1 if HR_Problem==0, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved MDMQ_before_GB_score MDMQ_before_CN_score MDMQ_before_AT_score, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2
			quietly: reg Task4Investcomp T_Stress Female TStress_Female Task1Solved dum_instrclear, cluster(session)
			lincomest 0.5*(T_Stress+TStress_Female)+0.5*T_Stress
			outreg2		


***************************************************************************************************************************************		
****************************** TABLE A.11 -  CORRELATION TABLE BETWEEN THE MAIN OUTCOME VARIABLES ***********************************************
*****************************************************************************************************************************************
	
	use "Data_stress_competition_gender.dta", clear

		spearman Task4Investcomp T_Stress Task3Solved confid_3 tourn_diff CertaintyEquivalent , stats(rho p) pw
		spearman Task4Investcomp T_Stress Task3Solved confid_3 tourn_diff CertaintyEquivalent  if Female==0, stats(rho p) pw
		spearman Task4Investcomp T_Stress Task3Solved confid_3 tourn_diff CertaintyEquivalent  if Female==1, stats(rho p) pw


***************************************************************************************************************************************		
****************************** TABLE A.12 - WTC FOR PAST PERFORMANCE (TASK 5 and TASK 6)*************************
*****************************************************************************************************************************************

use "Data_stress_competition_gender.dta", clear

			reg Task5Investcomp T_Stress Female Task1Solved , cluster(session)
			outreg2  using "Tables_Figures_Paper\Table_A12.xls", replace dec(2)
			reg Task5Investcomp T_Stress Female TStress_Female Task1Solved , cluster(session)
			outreg2
			reg Task5Investcomp T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task5Investcomp T_Stress Task1Solved if Female==1, cluster(session)
			outreg2
			
			reg Task6Investcomp T_Stress Female Task1Solved , cluster(session)
			outreg2  using "Tables_Figures_Paper\Table_A12.xls", append dec(2)
			reg Task6Investcomp T_Stress Female TStress_Female Task1Solved , cluster(session)
			outreg2
			reg Task6Investcomp T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task6Investcomp T_Stress Task1Solved if Female==1, cluster(session)
			outreg2		
		
		
***************************************************************************************************************************************		
****************************** TABLE A.13 - WTC BY CORTISOL RESPONSE, OLS AND  2SLS*************************
*****************************************************************************************************************************************

	use "Data_stress_competition_gender.dta", clear
	set more off

	reg Task4Investcomp cort_inc_2 Female Task1Solved ,cluster(session)
	outreg2  using "Tables_Figures_Paper\Table_A13.xls", replace dec(2)
	ivreg2 Task4Investcomp  (cort_inc_2 = T_Stress ) Female Task1Solved  , small cluster(session) first
	outreg2
	reg Task4Investcomp cort_inc_2 Task1Solved if Female==0,cluster(session)
	outreg2
	ivreg2 Task4Investcomp  (cort_inc_2 = T_Stress ) Task1Solved if Female==0 , small cluster(session) first
	outreg2
	reg Task4Investcomp cort_inc_2 Task1Solved if Female==1,cluster(session)
	outreg2
	ivreg2 Task4Investcomp  (cort_inc_2 = T_Stress ) Task1Solved if Female==1 , small cluster(session) first
	outreg2
	
	
***************************************************************************************************************************************		
****************************** TABLE A.14 - TOURNAMENT PERFORMANCE BY CORTISOL RESPONSE, OLS AND  2SLS********************************************************
*****************************************************************************************************************************************
	
	use "Data_stress_competition_gender.dta", clear
	set more off
	
		reg Task3Solved cort_inc_2 Female Task1Solved, cluster(session)
		outreg2 using "Tables_Figures_Paper\Table_A14.xls" , replace dec(2)
		ivreg2 Task3Solved (cort_inc_2 = T_Stress ) Female Task1Solved, small cluster(session) first
		outreg2
		reg Task3Solved cort_inc_2 Task1Solved if Female==0, cluster(session)
		outreg2
		ivreg2 Task3Solved (cort_inc_2 = T_Stress) Task1Solved if Female==0, small cluster(session) first
		outreg2
		reg Task3Solved cort_inc_2  Task1Solved if Female==1, cluster(session)
		outreg2
		ivreg2 Task3Solved (cort_inc_2 = T_Stress) Task1Solved if Female==1, small cluster(session) first
		outreg2

***************************************************************************************************************************************		
****************************** TABLE A.15 - SENSITIVITY ANALYSIS: WTC AND TOURNAMENT PERFORMANCE*****************************************
*****************************************************************************************************************************************	
		
		use "Data_stress_competition_gender.dta", clear
			
			reg Task4Investcomp T_Stress Female Task1Solved , cluster(session)
			outreg2  using "Tables_Figures_Paper\Table_A16.xls", replace dec(2) adjr2
			reg Task4Investcomp Task3Solved T_Stress Female Task1Solved , cluster(session)
			outreg2
			reg Task4Investcomp Task3Solved Female Task1Solved , cluster(session)
			outreg2

			reg Task4Investcomp T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task4Investcomp Task3Solved T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg Task4Investcomp Task3Solved Task1Solved if Female==0, cluster(session)
			outreg2

			reg Task4Investcomp T_Stress Task1Solved if Female==1, cluster(session)
			outreg2
			reg Task4Investcomp Task3Solved T_Stress Task1Solved if Female==1, cluster(session)
			outreg2
			reg Task4Investcomp Task3Solved Task1Solved if Female==1, cluster(session)
			outreg2

	
***************************************************************************************************************************************		
****************************** TABLE A.16 - SENSITIVITY ANALYSIS: TOURNAMENT PERFORMANCE AND RELATED CONFIDENCE *****************************************
*****************************************************************************************************************************************			
		use "Data_stress_competition_gender.dta", clear

			reg confid_3 T_Stress Female Task1Solved , cluster(session)
			outreg2  using "Tables_Figures_Paper\Table_A17.xls", replace dec(2) adjr2
			reg confid_3 Task3Solved T_Stress Female Task1Solved , cluster(session)
			outreg2
			reg confid_3 Task3Solved Female Task1Solved , cluster(session)
			outreg2

			reg confid_3 T_Stress Female Task1Solved if Female==0, cluster(session)
			outreg2
			reg confid_3 Task3Solved T_Stress Female Task1Solved if Female==0, cluster(session)
			outreg2
			reg confid_3 Task3Solved Female Task1Solved if Female==0, cluster(session)
			outreg2

			reg confid_3 T_Stress Female Task1Solved if Female==1, cluster(session)
			outreg2
			reg confid_3 Task3Solved T_Stress Female Task1Solved if Female==1, cluster(session)
			outreg2
			reg confid_3 Task3Solved Female Task1Solved if Female==1, cluster(session)
			outreg2

			
***************************************************************************************************************************************		
****************************** TABLE A.17 - CORTISOL RESPONSE ACROSS TREATMENTS (IV FIRST STAGE) ***************************************************
*****************************************************************************************************************************************
		
		use "Data_stress_competition_gender.dta", clear
			
			reg cort_inc_2 T_Stress Female Task1Solved, cluster(session)
			outreg2  using "Tables_Figures_Paper\Competitiveness_paper_122014.xls", replace dec(2)
			reg cort_inc_2 T_Stress Task1Solved if Female==0, cluster(session)
			outreg2
			reg cort_inc_2 T_Stress Task1Solved if Female==1, cluster(session)
			outreg2
			


****************************************************************************************************************************************************************************************
****************************************************************************************************************************************************************************************
***********************  FIGURES *****************************************************************************************************
****************************************************************************************************************************************************************************************
****************************************************************************************************************************************************************************************

****************************************************************************************************************************************************************************************
***********************  Figure 1: EFFECT OF TOURNAMENT INCENTIVES ON PERFORMANCE, BY TREATMENT AND GENDER *****************************************************************************************************
****************************************************************************************************************************************************************************************
						


			***Men 
			use "Data_stress_competition_gender.dta", clear
					keep if Female==0
						ttest tourn_diff, by(T_Stress)
						ranksum tourn_diff, by(T_Stress)

						collapse (mean) mean_tourndiff = tourn_diff (sd) sd_tourndiff = tourn_diff (count) n_tourn_diff =tourn_diff, by(T_Stress)
						generate hi_tourndiff = mean_tourndiff + (sd_tourndiff / sqrt(n_tourn_diff ))
						generate low_tourndiff = mean_tourndiff - (sd_tourndiff/ sqrt(n_tourn_diff ))

						gen T_Stress_help=0.3 if T_Stress==1
						replace T_Stress_help=0.8 if T_Stress==0
						
						***version 2 for paper
						graph twoway (bar mean_tourndiff T_Stress_help if T_Stress==1, barwidth(0.4) color(dknavy) lcolor(black) ) ///
						(bar mean_tourndiff T_Stress_help if T_Stress==0, barwidth(0.4) color(eltblue) lcolor(black)) ///
						 (rcap  hi_tourndiff low_tourndiff T_Stress_help, color(black)), legend(off) yline(0, lcolor(black)) ytitle(Effect of competition on performance) yscale(r(-1 1)) ///
						 ylabel(-1(0.5)1, format(%9.0g) nogrid angle(0)) xscale(r(0 1)) ///
						xlabel(0.3 "Stress treatment" 0.8 "Control", noticks) graphregion(color(white)) xtitle("", yoffset(-1.5)) 
						

			***Women
			use "Data_stress_competition_gender.dta", clear
					keep if Female==1
						ttest tourn_diff, by(T_Stress)
						ranksum tourn_diff, by(T_Stress)

						collapse (mean) mean_tourndiff = tourn_diff (sd) sd_tourndiff = tourn_diff (count) n_tourn_diff =tourn_diff, by(T_Stress)
						generate hi_tourndiff = mean_tourndiff + (sd_tourndiff / sqrt(n_tourn_diff ))
						generate low_tourndiff = mean_tourndiff - (sd_tourndiff/ sqrt(n_tourn_diff ))

						gen T_Stress_help=0.3 if T_Stress==1
						replace T_Stress_help=0.8 if T_Stress==0
						
						***version 2 for paper
						graph twoway (bar mean_tourndiff T_Stress_help if T_Stress==1, barwidth(0.4) color(cranberry) lcolor(black) ) ///
						(bar mean_tourndiff T_Stress_help if T_Stress==0, barwidth(0.4) color(erose) lcolor(black)) ///
						 (rcap  hi_tourndiff low_tourndiff T_Stress_help, color(black)), legend(off) yline(0, lcolor(black)) ytitle(Effect of competition on performance) yscale(r(-1 1)) ///
						 ylabel(-1(0.5)1, format(%9.0g) nogrid angle(0)) xscale(r(0 1)) ///
						xlabel(0.3 "Stress treatment" 0.8 "Control", noticks) graphregion(color(white)) xtitle("", yoffset(-1.5)) 

****************************************************************************************************************************************************************************************
***********************  Figure A.3: CORTISOL RESPONSE, BY TREATMENT *****************************************************************************************************
****************************************************************************************************************************************************************************************

use "Data_stress_competition_gender.dta", clear
		
		set more off
		expand 2, gen(duplicate_obs)
		tab duplicate_obs
		replace Female=2 if duplicate_obs==1
		tab Female

		rename Cort_1 Cort1
		rename Cort_2 Cort2
		rename Cort_3 Cort3

		reshape long Cort, i(subj_id duplicate_obs) j(Sample_order)

				gen help_order_graph=1 if T_Stress==1 &  Sample_order==1
				replace help_order_graph=2 if T_Stress==0 &  Sample_order==1
				replace help_order_graph=4 if T_Stress==1 &  Sample_order==2
				replace help_order_graph=5 if T_Stress==0 &  Sample_order==2
				replace help_order_graph=7 if T_Stress==1 &  Sample_order==3
				replace help_order_graph=8 if T_Stress==0 &  Sample_order==3

				collapse (mean) Cortisol_mean = Cort (sd) Cortisol_sd = Cort (count) Cortisol_N = Cort, by(help_order_graph T_Stress Female Sample_order)
				generate Cortisol_mean_low_se = Cortisol_mean - (Cortisol_sd / sqrt(Cortisol_N))	
				generate Cortisol_mean_hi_se = Cortisol_mean + (Cortisol_sd / sqrt(Cortisol_N))


		******version 2 / without the vertical bars showing the two TSST-G parts

								*Men
									twoway(bar Cortisol_mean help_order_graph if Female==0  & T_Stress==1, color(dknavy) lcolor(black)) /// 
									(bar Cortisol_mean help_order_graph if Female==0 & T_Stress==0, color(eltblue) lcolor(black)) ///
									(rcap  Cortisol_mean_hi_se Cortisol_mean_low_se help_order_graph if Female==0, color(black)), legend( row(1) order(1 "Stress treatment" 2 "Control" ) ) ///
										xlabel(1.5 "Sample 1" 4.5 "Sample 2" 7.5 "Sample 3", noticks) yscale(r(5 30)) ylabel(5(5)25, format(%9.0g) nogrid) ytitle("Mean cortisol concentration (nmol/l)", xoffset(-1) yoffset(-1)) xtitle("", yoffset(-1.5)) ///
									graphregion(color(white))	
									

								*Women
									twoway(bar Cortisol_mean help_order_graph if Female==1  & T_Stress==1, color(cranberry) lcolor(black)) /// 
									(bar Cortisol_mean help_order_graph if Female==1 & T_Stress==0, color(erose) lcolor(black)) ///
									(rcap  Cortisol_mean_hi_se Cortisol_mean_low_se help_order_graph if Female==1, color(black)),  legend( row(1) order(1 "Stress treatment" 2 "Control" ) ) ///
									xlabel(1.5 "Sample 1" 4.5 "Sample 2" 7.5 "Sample 3", noticks) yscale(r(5 30)) ylabel(5(5)25, format(%9.0g) nogrid) ytitle("Mean cortisol concentration (nmol/l)", xoffset(-1) yoffset(-1)) xtitle("", yoffset(-1.5)) ///
									graphregion(color(white))	

****************************************************************************************************************************************************************************************
***********************  Figure A.4: PERFORMANCE PIECE-RATE AND TOURNAMENT, BY TREATMENT AND GENDER *****************************************************************************************************
****************************************************************************************************************************************************************************************
		
use "Data_stress_competition_gender.dta", clear
	
		set more off
		expand 2, gen(duplicate_obs)
		tab duplicate_obs
		replace Female=2 if duplicate_obs==1
		tab Female

		rename Task1Solved TaskSolved1
		rename Task2Solved TaskSolved2
		rename Task3Solved TaskSolved3
		rename Task4Solved TaskSolved4

		reshape long TaskSolved, i(subj_id duplicate_obs) j(Task_order)

				gen help_order_graph=1 if T_Stress==1 &  Task_order==1
				replace help_order_graph=2 if T_Stress==0 &  Task_order==1
				replace help_order_graph=4 if T_Stress==1 &  Task_order==2
				replace help_order_graph=5 if T_Stress==0 &  Task_order==2
				replace help_order_graph=7 if T_Stress==1 &  Task_order==3
				replace help_order_graph=8 if T_Stress==0 &  Task_order==3
				replace help_order_graph=10 if T_Stress==1 &  Task_order==4
				replace help_order_graph=11 if T_Stress==0 &  Task_order==4

				collapse (mean) Solved_mean = TaskSolved (sd) Solved_sd = TaskSolved (count) Solved_N = TaskSolved, by(help_order_graph T_Stress Female Task_order)
				generate Solved_mean_low_se = Solved_mean - (Solved_sd / sqrt(Solved_N))	
				generate Solved_mean_hi_se = Solved_mean + (Solved_sd / sqrt(Solved_N))
		
					******Graph
							
								*Men
									twoway(bar Solved_mean help_order_graph if Female==0  & T_Stress==1, color(dknavy) lcolor(black)) /// 
									(bar Solved_mean help_order_graph if Female==0 & T_Stress==0, color(eltblue) lcolor(black)) ///
									(rcap  Solved_mean_hi_se Solved_mean_low_se help_order_graph if Female==0, color(black)), legend( row(1) order(1 "Stress treatment" 2 "Control" ) ) ///
									xlabel(1.5 "Task 1" 4.5 "Task 2" 7.5 "Task 3" 10.5 "Task 4", noticks) yscale(r(4 12)) ylabel(4(1)8, format(%9.0g) nogrid angle(0)) ytitle("", xoffset(-1) yoffset(-18)) xtitle("", yoffset(-1.5)) ///
									graphregion(fcolor(white) color(white) lcolor(white))
									
								*Women
									twoway(bar Solved_mean help_order_graph if Female==1  & T_Stress==1, color(cranberry) lcolor(black)) /// 
									(bar Solved_mean help_order_graph if Female==1 & T_Stress==0, color(erose) lcolor(black)) ///
									(rcap  Solved_mean_hi_se Solved_mean_low_se help_order_graph if Female==1, color(black)),  legend( row(1) order(1 "Stress treatment" 2 "Control" ) ) ///
									xlabel(1.5 "Task 1" 4.5 "Task 2" 7.5 "Task 3" 10.5 "Task 4", noticks) yscale(r(4 12)) ylabel(4(1)8, format(%9.0g) nogrid angle(0)) ytitle("", xoffset(-1) yoffset(-18)) xtitle("", yoffset(-1.5)) ///
									graphregion(fcolor(white) lcolor(white))
									
									
****************************************************************************************************************************************************************************************
***********************   Figure A.5: EFFECT OF STRESS TREATMENT AND TOURNAMENT INCENTIVES ON PERFORMANCE, CUMULATIVE DISTRIBUTION FUNCTIONS BY GENDER   *****************************************************************************************************
****************************************************************************************************************************************************************************************
use "Data_stress_competition_gender.dta", clear


cdfplot stress_diff if Female==1, by(T_Stress) title(Females) xscale(r(-6(2)6)) xlabel(-6(2)6) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Effect of stress treatment (Task 2 - Task 1)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(erose cranberry ))
cdfplot stress_diff if Female==0, by(T_Stress) title(Males) xscale(r(-6(2)6)) xlabel(-6(2)6) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Effect of stress treatment (Task 2 - Task 1)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(eltblue dknavy ))

cdfplot tourn_diff if Female==1, by(T_Stress) title(Females) xscale(r(-6(2)6)) xlabel(-6(2)6) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Effect of tournament incentives (Task 3 - Task 2)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(erose cranberry ))
cdfplot tourn_diff if Female==0, by(T_Stress) title(Males) xscale(r(-6(2)6)) xlabel(-6(2)6) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Effect of tournament incentives (Task 3 - Task 2)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(eltblue dknavy ))

										
								
****************************************************************************************************************************************************************************************
***********************  Figure A.6: WILLINGNESS TO COMPETE, BY TREATMENT AND GENDER *****************************************************************************************************
****************************************************************************************************************************************************************************************

use "Data_stress_competition_gender.dta", clear

			set more off
			expand 2, gen(duplicate_obs)
			tab duplicate_obs
			replace Female=2 if duplicate_obs==1
			tab Female

						gen help_order_graph=1 if T_Stress==1 &  Female==2
						replace help_order_graph=2 if T_Stress==0 &  Female==2
						replace help_order_graph=3.5 if T_Stress==1 &  Female==0
						replace help_order_graph=4.5 if T_Stress==0 &  Female==0
						replace help_order_graph=6 if T_Stress==1 &  Female==1
						replace help_order_graph=7 if T_Stress==0 &  Female==1
						
						
						collapse (mean) Competit_mean = Task4Investcomp (sd) Competit_sd = Task4Investcomp (count) Competit_N = Task4Investcomp, by(help_order_graph T_Stress Female)
						generate Competit_mean_low_se = Competit_mean - (Competit_sd / sqrt(Competit_N))	
						generate Competit_mean_hi_se = Competit_mean + (Competit_sd / sqrt(Competit_N))
											
						gen Competit_mean_help=Competit_mean
						format Competit_mean_help %9.1f	


					****Graph
						twoway (bar Competit_mean help_order_graph if  T_Stress==1 &  Female==2, color(gs4) lcolor(black))  ///
						(bar Competit_mean help_order_graph if  T_Stress==0 &  Female==2, color(gs12) lcolor(black))  ///
						(bar Competit_mean help_order_graph if  T_Stress==1 &  Female==0, color(dknavy) lcolor(black)) ///
						(bar Competit_mean help_order_graph if  T_Stress==0 &  Female==0, color(eltblue) lcolor(black)) ///
						(bar Competit_mean help_order_graph if  T_Stress==1 &  Female==1 , color(cranberry) lcolor(black)) ///
						(bar Competit_mean help_order_graph if  T_Stress==0 &  Female==1 , color(erose) lcolor(black)) ///
						(rcap  Competit_mean_low_se Competit_mean_hi_se help_order_graph , color(black)), ///
						legend( row(1) order(1 "Darker color indicates Stress treatment" ) symxsize(0))  xlabel(1.5 "All" 4 "Men" 6.5 "Women"  , noticks) ytitle("Points invested into tournament (out of 100)") ///
						yscale(r(20 70)) ylabel(20(10)70, format(%9.0g) nogrid angle(90)) xtitle("", yoffset(-1.5)) graphregion(color(white)) 
						
								
****************************************************************************************************************************************************************************************
***********************   Figure A.7: EFFECT OF STRESS TREATMENT ON WILLINGNESS TO COMPETE, CUMULATIVE DISTRIBUTION FUNCTIONS BY GENDER.   *****************************************************************************************************
****************************************************************************************************************************************************************************************
use "Data_stress_competition_gender.dta", clear

cdfplot Task4Investcomp if Female==1, by(T_Stress) title(Females) xscale(r(0(10)100)) xlabel(0(10)100) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Willingness to compete: points invested into tournament ex ante (Task 4)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(erose cranberry ))
cdfplot Task4Investcomp if Female==0, by(T_Stress) title(Males) xscale(r(0(10)100)) xlabel(0(10)100) graphregion(color(white)) yscale(r(0 1)) ylabel(0(0.2)1, format(%9.0g) nogrid ) xtitle("Willingness to compete: points invested into tournament ex ante (Task 4)", yoffset(-1.5)) legend( row(1) order(1 "c.d.f. of control treatment" 2 "c.d.f. of stress treatment")) opt1( lc(eltblue dknavy ))


			